<?php 
function connect()
{
    $link = @mysql_connect('localhost','root','')
    or die("<p>无法连接数据库！</p>");
    mysql_set_charset('utf8');
   mysql_select_db('neu-video')

    or die("<p>无法查询数据库！</p>");
    return $link;
}
connect();
$search=$_GET['search'];

$sql="select * from food where name like '%{$search}%' ";
$re=mysql_query($sql) or die('查询失败！'.mysql_error());

 ?>
   <center><h3>菜谱信息列表</h3></center>
   <table class="table table-hover">
   <thead>
   	<tr>
     <th>菜谱名</th>   
     <th>菜谱图片</th>
   </tr>
   </thead>

   <tbody>
   <?php
    while($row=mysql_fetch_assoc($re) ){
     echo '<tr>';
  /*   echo '<td>'.$row['vid'].'</td>';*/
     echo '<td>'.$row['name'].'</td>';  
      echo '<td align="center"><img src="Upload/'.$row['pic'].'" width=60 height=80 alt="无头像"></td>';
     echo '</tr>';  
    }
    echo '</tbody>';
    echo '</table>';  
    $totalrows = count($row);
    echo "<table align='center'><tr><td>共有{$totalrows}条记录</td></tr></table>"   ;
   ?>